import request from './wrapRequest';
/**
 * 接口分类
 * @param data 
 * @returns 
 */
export interface CategoryProps{
    _id: string | null;
    categoryName: string;
    parentId: string;
    parentName?: string;
    desc: string;
}
/**
 * 暂时不做分页
 * @returns 
 */
export const fetchList = () => {
  return  request.get<CategoryProps[]>(`/admin/user/api/category/list`);
}

/**
 * 增加接口分类
 * @param data 
 * @returns 
 */
export const addCategory = (data: CategoryProps) => {
  return  request.put<boolean>(`/admin/user/api/category/create`, data);
}


/**
 * 更新接口分类
 * @param data 
 * @returns 
 */
export const updateCategory = (data: CategoryProps) => {
  return  request.post<boolean>(`/admin/user/api/category/update`, data);
}

/**
 * 删除接口分类
 * @param data 
 * @returns 
 */
export const deleteCategory = (data: CategoryProps) => {
  return  request.delete<boolean>(`/admin/user/api/category/delete/`+ data._id);
}